<template>
  <div class="body1" style="padding-top:10px;">
      <div class="form_select">
        <div>
          <el-input class="select_input" size="small" 
          v-model="form.realname" placeholder="员工姓名"></el-input>
          <el-button type="primary"  size="small" @click="getList">搜索</el-button>
        </div>
        <div class="select_right">
          <!--<el-button type="primary"  size="small" @click="addClick()">添加员工</el-button>-->
        </div>
      </div>
      <staffTable :list="list" @func="dialogClose"></staffTable>
      <staffEdit :show="staffEditShow" :form="staffEdit" @func="dialogClose"></staffEdit>
  </div>
</template>
 
<script>
import staffTable from "./staffTable"
import staffEdit from "./staffEdit"
export default {
  name: "Staff",
  data() {
    return {
      form:{},
      list:[],
      staffEditShow:false,
      staffEdit:[]
    };
  },
   components: {
    "staffTable": staffTable,
    "staffEdit":staffEdit
  },
  created: function() {
    this.getList();
  },
  methods: {
    getList:function(){
        this.form.oa_id = localStorage.getItem('oa_id')
        var that = this
        this.$get('pc/staff/all',this.form).then((res) => {
            that.list = res.data
        })
    },
    dialogClose:function(data){
      this[data.key+'Show'] = !this[data.key+'Show']
      if(data.item){
        this[data.key] = data.item
      }
      if(data.type){
        this.getList()
      }
    }
  }
};
</script>
<style>
</style>